
//初始化数据
function tabbarinit() {
  return [
    {
      "current": 0,
      "pagePath": "/pages/index/index",
      "iconPath": "/images/home.png",
      "selectedIconPath": "/images/home@selected.png",
      "text": "首页"
    },
    {
      "current": 0,
      "pagePath": "/pages/introduction/introduction",
      "iconPath": "/images/intro.png",
      "selectedIconPath": "/images/intro@selected.png",
      "text": "简介"

    },
  
    {
      "current": 0,
      "pagePath": "/pages/inspect/inspect",
      "iconPath": "/images/inspect.png",
      "selectedIconPath": "/images/inspect@selected.png",
      "text": "市场检查"
    },
    {
      "current": 0,
      "pagePath": "/pages/sao/sao",
      "iconPath": "/images/intro.png",
      "selectedIconPath": "/images/intro@selected.png",
      "text": "扫黄打非"
    },/*
        {
            "current": 0,
            "pagePath": "/pages/complain/complain",
            "iconPath": "/images/complain.png",
            "selectedIconPath": "/images/complain@selected.png",
            "text": "投诉举报"
        }*/
  ]

}
function tabbarJinit() {
  return [
    {
      "current": 0,
      "pagePath": "/pages/index/index",
      "iconPath": "/images/home.png",
      "selectedIconPath": "/images/home@selected.png",
      "text": "首页"
    },
    {
      "current": 0,
      "pagePath": "/pages/introduction/introduction",
      "iconPath": "/images/intro.png",
      "selectedIconPath": "/images/intro@selected.png",
      "text": "简介"

    },
    {
      "current": 0,
      "pagePath": "/pages/complain/complain",
      "iconPath": "/images/complain.png",
      "selectedIconPath": "/images/complain@selected.png",
      "text": "投诉举报"
    }, {
      "current": 0,
      "pagePath": "/pages/sao/sao",
      "iconPath": "/images/intro.png",
      "selectedIconPath": "/images/intro@selected.png",
      "text": "扫黄打非"
    },
  ]

}
/**
 * tabbar主入口
 * @param  {String} bindName 
 * @param  {[type]} id       [表示第几个tabbar，以0开始]
 * @param  {[type]} target   [当前对象]
 */
function tabbarmain(bindName = "tabdata", id, target, show) {
  var that = target;
  var bindData = {};

  if (show == 1) {
    var otabbar = tabbarinit();
  } else {
    var otabbar = tabbarJinit();
  }

  otabbar[id]['iconPath'] = otabbar[id]['selectedIconPath']//换当前的icon
  otabbar[id]['current'] = 1;
  bindData[bindName] = otabbar
  //console.log(otabbar);
  that.setData({ bindData });
}


module.exports = {
  tabbar: tabbarmain
}